<!DOCTYPE html>
<html lang="en"
      xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="utf-8">
    <title>Shipments - SEE</title>
</head>
<body>
<table id="allShipments" class="table table-striped">
    <thead>
    <tr>
        <th>Id</th>
        <th>Courier Id</th>
        <th>Status</th>
        <th>Address</th>
        <th>Assign</th>
    </tr>
    </thead>
    <tbody>
    <tr class="result" data-th-each="shipment : ${shipments}">
        <td>[[${shipment.aggregateIdentifier}]]</td>
        <td>[[${shipment.courierId}]]</td>
        <td>[[${shipment.state}]]</td>
        <td>[[${shipment.address}]]</td>
        <td>

            <form class="card-body" th:if="${shipment.courierId == null}"
                  th:action="@{/shipments/{shippmentId}/assigned(shippmentId = ${shipment.aggregateIdentifier})}"
                  th:object="${assignShipmentRequest}"
                  method="post">
                <div class="form-group">
                    <select class="form-control" id="courierOptionId" th:field="*{courierId}">
                        <option data-th-each="courier : ${couriers}" th:value="${courier.id}"
                                th:text="${courier.firstName}">
                        </option>
                    </select>

                </div>
                <input data-toggle="tooltip" data-placement="top"
                       title="Assign Shipment to Courier" type="submit" value="Assign"
                       class="btn btn-primary"/>
            </form>
        </td>
    </tr>
    </tbody>
</table>
</body>

